<?php

class Controller_Admin_Appearance_Menu_Edit extends Controller
{
	function execute($request)
	{
		$menu_id = $request -> getParam('menu-id');
		
		$menu = Model::factory('agilet_menu', $menu_id);
		
		$form = new Form_Admin_Menu_AddElement;

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$values = $form -> getValues();

			$menu -> editItem($values);

			$menu -> save();
		}
		
		$request -> response = View::render(array(
			'form' => $form,
			'menu' => $menu
		), 'admin/edit');
		}

}
